package com.atguigu.memento.game;

public class Client {
    public static void main(String[] args) {
        GameRole gameRole = new GameRole();
        gameRole.setAttack(100);
        gameRole.setDefense(100);

        System.out.println("和Boss大战前的状态");
        gameRole.display();

        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(gameRole.createMemento());

        System.out.println("和Boss大战");
        gameRole.setAttack(50);
        gameRole.setDefense(50);
        gameRole.display();

        System.out.println("大战后，使用备忘录对象恢复到战前");

        gameRole.recoverGameRoleFromMemento(caretaker.getMemento());
        System.out.println("恢复后的状态");
        gameRole.display();
    }
}
